package com.shy.springframework.context.event;


import com.shy.springframework.beans.factory.BeanFactory;
import com.shy.springframework.context.ApplicationEvent;
import com.shy.springframework.context.ApplicationListener;

/**
 * @author yzpang
 * @desc:
 * @date: 2023/2/9 15:56
 */
public class SimpleApplicationContextMulticaster extends AbstractApplicationEventMulticaster{

    public SimpleApplicationContextMulticaster(BeanFactory beanFactory) {
        setBeanFactory(beanFactory);
    }

    @SuppressWarnings("unchecked")
    @Override
    public void multicastEvent(final ApplicationEvent event) {
        for (final ApplicationListener listener : getApplicationListeners(event)) {
            listener.onApplicationEvent(event);
        }
    }
}
